@extends('Admin.layout.layout')

@section('before.css')
    <link href="{{asset('css/plugins/iCheck/custom.css')}}" rel="stylesheet">
@endsection

@section('content')
    <div class="wrapper wrapper-content animated fadeInRight">
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>添加权限 <small></small></h5>
                    </div>
                    <div class="ibox-content">
                        <form class="form-horizontal m-t" id="Form" action="/foradmin/action" method="post">
                            {!!  csrf_field() !!}
                            <div class="modal-body">
                                <div class="form-group">
                                    <label class="col-sm-3 control-label">操作分组：</label>
                                    <div class="col-sm-8">
                                        <select name="group" class="form-control">
                                            @foreach($groups as $g)
                                                <option value="{{$g}}">{{$g}}</option>
                                            @endforeach
                                        </select>
                                        @include('Admin.layout.tip',['field' => 'group'])
                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="col-sm-3 control-label">操作名称：</label>
                                    <div class="col-sm-8">
                                        <input id="name" name="name" value="{{ old('name') }}" class="form-control" type="text" aria-required="true" aria-invalid="false" class="valid">
                                        @include('Admin.layout.tip',['field' => 'name'])
                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="col-sm-3 control-label">描述：</label>
                                    <div class="col-sm-8">
                                        <input id="description" value="{{ old('description') }}" name="description" class="form-control" type="text" aria-required="true" aria-invalid="false" class="valid">
                                        @include('Admin.layout.tip',['field' => 'description'])
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-3 control-label">操作标识：</label>
                                    <div class="col-sm-8">
                                        <select name="action" class="form-control">
                                            @foreach($actions as $a)
                                                <option value="{{$a}}">{{$a}}</option>
                                            @endforeach
                                        </select>
                                        @include('Admin.layout.tip',['field' => 'action'])
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-3 control-label">是否禁用：</label>
                                    <div class="col-sm-8">
                                        <div class="radio i-checks">
                                            <label><input @if(old('state',1) == 1) checked @endif type="radio" name="state" value="1"/></label>启用
                                            <label><input @if(old('state',1) == 0) checked @endif type="radio" name="state" value="0"/></label>禁用
                                        </div>
                                        @include('Admin.layout.tip',['field' => 'state'])
                                    </div>
                                </div>
                            </div>
                            <div class="modal-footer">
                                <a href="/foradmin/action" class="btn btn-default pull-left">返回</a>
                                <button type="submit" class="btn btn-primary" id="btn_submit">
                                    确定
                                </button>
                                <a href="/foradmin/action" class="btn btn-default return"
                                   data-dismiss="modal" >取消
                                </a>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script src="{{asset('js/plugins/iCheck/icheck.min.js')}}"></script>
    <script>
        $(document).ready(function () {
            $('.i-checks').iCheck({
                checkboxClass: 'icheckbox_square-green',
                radioClass: 'iradio_square-green',
            });
        });

    </script>
@endsection
